package com.itheima;

import java.util.Random;

public class tes {
    public static void main(String[] args) {
        Random r = new Random();

        int[] arr = new int[6];

        for (int i = 0; i < arr.length; i++) {
            arr[i] = r.nextInt(10) + 1;
        }
        System.out.println("数组中的数据为:");

        int num = 0;
        for (int i = 0; i < arr.length; i++) {
            System.out.print(arr[i] + " ");
            num += arr[i];
        }
        System.out.println();
        int max = arr[0];
        int min = arr[0];
        for (int i = 1; i < arr.length; i++) {
            if (max < arr[i]) {
                max = arr[i];
            }
            if (min > arr[i]) {
                min = arr[i];
            }
        }
        System.out.println("最大值为:" + max);
        System.out.println("最小值为:" + min);

        System.out.println("平均数为:" + (num - max - min) / 4);
    }
}
